<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use App\Models\Relations\UserInfoTrait;
class Comments extends Model
{
    use UserInfoTrait;
    protected $table = "comments";
    
    protected $primaryKey = 'comment_id';
    
    protected $fillable = array('comment_id','app_table','app_id','user_id','title','content','to_comment_id','to_user_id','status');
    
    protected $dates = ['deleted_at'];
    
    /**
     * 评论对回复，一对多
     */
    public function childComments()
    {
        return  $this->hasMany('App\Models\Comments','to_comment_id','comment_id');
    }
    /**
     * 职场一对一
     */
    public function teaches()
    {
        return  $this->hasOne('App\Models\Teaches','id','app_id');
    }
    /**
     * 企业内训
     */
    public function teachesc()
    {
        return  $this->hasOne('App\Models\TeachesCompany','id','app_id');
    }
    /**
     * 企业课程
     */
    public function teachescc()
    {
        return  $this->hasOne('App\Models\TeachesContent','id','app_id');
    }

}

